//#include<stdio.h>
//int main()
//{
//    double money = 0.0;
//    int month = 0;
//    int day = 0;
//    int discount = 0;
//    double n = 0.7;
//    double m = 0.8;
//    while (scanf_s("%lf %d %d %d", &money, &month, &day, &discount) != EOF)
//    {
//        if ((month == 11) && (day == 11) && (discount == 1))
//        {
//            money = money * n - 50;
//            printf("%lf", money);
//        }
//    }
//
//
//
//
//
//
//    return 0;
//}
#include<stdio.h>
int main()
{
    double money = 0.0;
    int month = 0;
    int day = 0;
    int discount = 0;
    scanf_s("%lf %d %d %d", &money, &month, &day, &discount);
        if ((month == 11) && (day == 11))
        {
            money = money *0.7 - 50.0*discount;
            printf("%.2lf", money);
        }
        else if ((month == 12) && (day == 12))
        {
            money = money *0.8- 50.0*discount;
            printf("%.2lf", money);
        }
        else if (money<0)
        {
            printf("0.0\n", money);
        }
        else 
        {
            printf("%.2lf", money);
    }
    return 0;
}